import {CFormGroupProps} from "@/components/CProForm/CFormItem/type";
import {InputNumber} from "antd";

// @ts-ignore
export const field: CFormGroupProps<any>[] = (databaseName: string): CFormGroupProps<any>[] => [
  {
    itemList: [
      {
        name: "tableName",
        label: "表名",
        width: "md",
        rules: [
          {
            required: true,
            message: "表名是必须"
          }
        ]
      },
      {
        name: "className",
        label: "类名",
        width: "md",
        rules: [
          {
            required: true,
            message: "表名是必须"
          }
        ]
      },
      {
        name: "databaseName",
        label: "数据库名",
        width: "md",
        initialValue: databaseName,
        disabled: true
      },
    ],
  },
  {
    itemList: [
      {
        name: "charset",
        label: "表字符集",
        width: "md",
        initialValue: "utf8mb4",
        disabled: true
      },
      {
        name: "charsetSort",
        label: "表字符排序规则",
        width: "md",
        initialValue: "utf8mb4_general_ci",
        disabled: true
      },
      {
        name: "autoIncrement",
        label: "自增起始",
        width: "md",
        initialValue: 0,
        Component: InputNumber,
        componentProps: {
          size: "middle"
        }
      },
    ],
  },
  {
    itemList: [
      {
        name: "engine",
        label: "引擎",
        width: "md",
        initialValue: "InnoDB",
        disabled: true
      }
    ]
  },
  {
    itemList: [
      {
        name: "desc",
        label: "描述",
        type: "text",
        width: "md",
      }
    ]
  }
]
